import random

# 定义手势选项
gestures = ["石头", "剪刀", "布"]

def play_game():
    print("欢迎来到猜拳游戏！")
    while True:
        player_choice = input("请输入你的选择（石头、剪刀、布），输入 '退出' 结束游戏：")
        if player_choice == "退出":
            print("游戏结束，感谢参与！")
            break
        if player_choice not in gestures:
            print("输入无效，请输入 '石头'、'剪刀' 或 '布'。")
            continue

        computer_choice = random.choice(gestures)
        print(f"你出了 {player_choice}，电脑出了 {computer_choice}。")

        if player_choice == computer_choice:
            print("平局！")
        elif (
            (player_choice == "石头" and computer_choice == "剪刀") or
            (player_choice == "剪刀" and computer_choice == "布") or
            (player_choice == "布" and computer_choice == "石头")
        ):
            print("你赢了！")
        else:
            print("你输了！")

if __name__ == "__main__":
    play_game()